Skip to content

Update Python and Sphinx support for v1.1.0#78

Closed
mmcky wants to merge 5 commits intomainfrom
fix-tests
Closed

Update Python and Sphinx support for v1.1.0#78
mmcky wants to merge 5 commits intomainfrom
fix-tests

Conversation

@mmcky
Copy link
Member

@mmcky mmcky commented Oct 21, 2025

Summary

This PR modernizes the package to support current Python and Sphinx versions, adds version-specific test fixtures to handle differences between Sphinx 7 and 8, and fixes deprecation warnings for Sphinx 9 compatibility.

Changes

Breaking Changes ⚠️

  • Dropped Python 3.9 and 3.10 support - Minimum Python version is now 3.11
  • Dropped Sphinx 4 and 5 support - Minimum Sphinx version is now 6.0

Improvements

  • Sphinx 9 Compatibility: Fixed deprecation warnings by updating sphinx.util.import_object to sphinx.util.importer.import_object
  • Version-Specific Test Fixtures: Implemented separate test fixtures for Sphinx 7 (.sphinx7) and Sphinx 8 (.sphinx8) to handle HTML output differences (primarily navigation links from myst-nb)
  • Test Infrastructure: Updated test suite to dynamically select fixtures based on Sphinx version using SPHINX_VERSION variable

Documentation

  • CHANGELOG: Added missing entries for v1.0.0 and v1.0.1 releases
  • CHANGELOG: Prepared v1.1.0 release notes documenting all changes

Testing

  • ✅ All 110 tests pass on Sphinx 7
  • ✅ All 110 tests pass on Sphinx 8
  • ✅ No deprecation warnings on Sphinx 9

Version Bump

This release should be tagged as v1.1.0 (minor version bump due to breaking changes in supported Python/Sphinx versions).

Related Issues

Fixes issues with:

  • Sphinx 9 deprecation warnings
  • Test failures with different Sphinx versions due to HTML output variations
  • Outdated Python and Sphinx version support

Next Steps

After approval, before merging:

  • Update version number in sphinx_exercise/__init__.py from "1.0.1" to "1.1.0"
  • Create git tag v1.1.0 after merge
  • Publish to PyPI

mmcky added 5 commits October 21, 2025 12:40
**Breaking Changes:**
- Drop Python 3.9 and 3.10 support (now requires Python >= 3.11)
- Drop Sphinx <6 support (now requires Sphinx >= 6)

**Improvements:**
- Update test matrix to Python 3.11, 3.12, 3.13
- Test against Sphinx 7 and 8 (modern, actively supported versions)
- Remove outdated Sphinx 4 and 5 test fixtures
- Generate Sphinx 8 test fixtures
- Fix tox.ini Sphinx 6 environment configuration
- Update pyproject.toml dependencies to align with ecosystem

**Rationale:**
- pydata-sphinx-theme (core dependency) requires Sphinx >= 6.1
- Python 3.9 EOL October 2025, Python 3.10 EOL October 2026
- Aligns with modern Python/Sphinx ecosystem
- Reduces maintenance burden of supporting legacy versions

All 110 tests passing on:
- Python 3.11 + Sphinx 7.4.7 ✓
- Python 3.11 + Sphinx 8.2.3 ✓
Fixes:
- Replace deprecated strip_escseq with strip_escape_sequences
- Use pathlib.Path instead of string path manipulation in directive.py
- Use pathlib.Path instead of string path manipulation in post_transforms.py
- Fix import ordering in directive.py

Impact:
- Reduced warnings from 1535 to 1358 on Sphinx 7 (177 fewer warnings)
- Reduced warnings from 1535 to 1388 on Sphinx 8 (147 fewer warnings)
- Only remaining warnings are from third-party myst_nb package

All 110 tests still passing on Sphinx 7
- Regenerated test fixtures to include navigation links added by newer myst-nb
- These fixtures now match Sphinx 7 behavior with myst-nb 1.0.0
- Sphinx 8 tests show same navigation links (expected to fail for now)
- All 110 tests pass on Sphinx 7
- Updated test files to use SPHINX_VERSION for version-specific fixtures
- Renamed existing fixtures to .sphinx7.html/.sphinx7.xml format
- Generated .sphinx8.html/.sphinx8.xml fixtures for Sphinx 8
- All 110 tests now pass on both Sphinx 7 and Sphinx 8
- Handles differences in myst-nb navigation link generation between versions

Modified test files:
- tests/test_exercise_references.py
- tests/test_solution.py
- tests/test_solution_references.py

Fixture changes:
- 13 HTML fixtures in test_exercise_references/ (now .sphinx7 and .sphinx8)
- 13 XML fixtures in test_exercise_references/ (now .sphinx7 and .sphinx8)
- 5 HTML fixtures in test_solution_references/ (now .sphinx7 and .sphinx8)
- 6 XML fixtures in test_solution_references/ (now .sphinx7 and .sphinx8)
- 1 XML fixture in test_solution/ (now .sphinx7 and .sphinx8)
- 9 XML fixtures in test_solution/ (now .sphinx7 and .sphinx8)
@mmcky mmcky changed the title Modernize Python and Sphinx support for v1.1.0 Update Python and Sphinx support for v1.1.0 Oct 21, 2025
@mmcky mmcky closed this Oct 21, 2025
@mmcky mmcky deleted the fix-tests branch October 21, 2025 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant